<template>
  <div class="credential-details-container">
    <HeaderIndex title="资质证书详情" />
    <div class="credential-info">
      <div>
        <p v-for="(item, index) in list" :key="index">
          <span>{{ item.title }}</span>
          <span>{{ item.content | isEmptyData }}</span>
        </p>
      </div>
    </div>
  </div>
</template>

<script>
import { getCertificate } from "@/api";
import { Toast } from "@/utils";
import HeaderIndex from "@/components/header";
export default {
  name: "CredentialDetails",
  components: {
    HeaderIndex,
  },
  data() {
    return {
      list: [],
    };
  },
  async created() {
    try {
      Toast.startLoading();

      //路由参数解构
      const { companyName, pageNum, index } = this.$route.query;

      // 获取电信许可信息
      const { items = [] } =
        (await getCertificate({
          companyName,
          pageNum,
        })) || {};

      //获取相应详情数据
      this.list = items[index % 20]?.detail;
    } finally {
      Toast.closeLoading();
    }
  },
};
</script>

<style lang="less" scoped>
@import url("~@/assets/styles/credentialDetails/index.less");
</style>